public class Solution {

    public static int StrToInt(String str) {
        int i = 0;
        int r=0;
        while(i<str.length()){
            if(str.charAt(i)=='+'||str.charAt(i)=='-'||str.charAt(i)=='/'){
            i++;
            }
            if(str.charAt(i)>='0'&&str.charAt(i)<='9'){
                r = r*10+str.charAt(i)-'0';
                i++;
            }
            else return 0;
        }
        return r;
    }

    public static void main(String[] args) {
        String s = "+2147483647";
        System.out.println(StrToInt(s));
    }
}